<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>法律人</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/my-style.css">
	<!--[if lt IE 9]> 
		<script src="js/html5shiv.min.js"></script> 
	<![endif]-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function() {
			var title_rul = /^.{6,15}$/;
			var content_rul = /^.{5,20}$/;
			$("#publish").click(function(){
				   var title = $("#input-doubt").val();
				   var content = $("#input-doubt-info").val();
				   var flag = true;
				   if(title == ""){
						alert("请输入问题!");
						flag = false;
					}else if(!title_rul.test(title)){
						alert("请输入6~15个字!");
						flag = false;
					}else if(content==""){
						alert("请输入问题内容!");
						flag = false;
					}else if(!content_rul.test(content)){
						alert("请输入5~20个字!");
						flag = false;
					}
				   if(flag){
				    var url = "user/ask";
					var args = $("#question").serialize();
					$.post(url, args, function(data) {
						alert(data.MSG);
					});
				}
			});
		});
	</script>
</head>
<body>
	<!-- 导航栏 -->
	<header>
		<nav class="navbar navbar-inverse">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
		      <a class="navbar-brand" href="index.html">
		        <img alt="LOGO" src="img/50x30.png">
		      </a>
				</div>
				<div class="collapse navbar-collapse" id="navbar-collapse-1">
					<ul class="nav navbar-nav navbar-left">
					 	  <li><a href="index/home">首页</a></li>
				          <li class="cur"><a href="lawyer/list">法律人</a></li>
				          <li><a href="contract/list">法律产品</a></li>
				         <li><a href="knowledge/index">法律知识</a></li>
				          <li><a href="javascript:;">招聘</a></li>
					</ul>

					<ul class="nav navbar-nav navbar-right">
						<li><a class="add-btn" href="index/join">法律人入驻<span class="caret"></span></a></li>
				<c:if test="${sessionScope.user == null}">
					<li><a href="user/login">登录</a></li>
					<li><a href="user/register">注册</a></li>
				</c:if>
				<c:if test="${sessionScope.user != null}">
					 	<li>
								<c:if test="${sessionScope.user.type  == 0}">
								<a href="user/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 1}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
								<c:if test="${sessionScope.user.type  == 2}">
								<a href="lawyer/person">${sessionScope.user.username}</a>
								</c:if>
					    </li>
					<li><a href="user/user/logout">退出</a></li>
				</c:if>
			</ul>
				</div>
			</div>
		</nav>
	</header>

	<section class="lawyer" style="background:#fff;padding-top:15px;margin-bottom:20px;">
		<div class="container">
			<div class="row">
				<div class="col-md-12 col-sm-12 col-xs-12">
					<div class="media" style="border:0;">
						  <div class="media-left">
						    <a href="#">
						    	<img class="media-object" src="http://localhost:8080/${lawyersDetails.idcardimg}" alt="..." style="height:120px ;width:100px">
						    </a>
						  </div>
						  <div class="media-body">
					    	<div class="media-left">
					    	<h3 class="media-heading">${lawyersDetails.name}律师</h3>
					    	<i class="icon icon-like">1700</i>
						    <div class="media-content">
						    	<span class="icon icon-home-outline">${lawyersDetails.address}</span>
						    	<span class="icon icon-location">${lawyersDetails.provinceName}</span>
						    	<span class="icon icon-clock">执业年限:
											<c:choose>
									    			<c:when test="${lawyersDetails.membership == 1}">5年以下</c:when>
									    			<c:when test="${lawyersDetails.membership == 2}">5~10年</c:when>
									    			<c:otherwise>10年以上</c:otherwise>
									    	</c:choose>
								</span>
						    </div>		
						    <div class="media-content">
									<label>${lawyersDetails.specialNameA}</label>
						    </div>			 
					    </div>	
						  </div>
						  
						</div>
				</div>
			</div>
		</div>
	</section>

	<section>
		<div class="container">
			<div class="row">
				<div class="col-md-9 col-sm-9 col-xs-12">
					<div class="col-md-12 col-sm-12 col-xs-12 clear-padding">
						<div class="tab-title clearfix">
							<span>首页</span>
							<span class="hidden-xs">我在滴滴法律,我承诺,您的每一个问题,我都会认真解答!</span>
						</div>
						<div class="col-md-12 col-sm-12 col-xs-12 clear-padding" style="background:#fff;padding:10px 0;">
							<div class="col-md-6 col-sm-6 col-xs-12 clear-padding-right">
								<div class="lawyer-detail-box pull-left">
									<h5>个人描述</h5>
									<hr/>
									<p>${lawyersDetails.intro}</p>
								</div>
							</div>


							<div class="col-md-6 col-sm-6 col-xs-12 clear-padding-left">
								<div class="lawyer-detail-box pull-right">
									<h5>请张振霖律师为我服务</h5>
									<hr/>
									<form class="form-horizontal" id="question">
									  <div class="form-group">
									    <label for="input-doubt" class="col-sm-3 control-label">您的疑问</label>
									    <div class="col-sm-8">
									      <input type="email" class="form-control" id="input-doubt"  placeholder="一句话描述您的问题" name="questitle">
									    </div>
									  </div>
									  <div class="form-group">
									    <label for="input-doubt-info" class="col-sm-3 control-label">问题详情</label>
									    <div class="col-sm-8">
									      <textarea class="form-control" rows="4" placeholder="尽可能详细描述您的需求详情" id="input-doubt-info" name="quescontent"></textarea>
									    </div>
									    <input type="hidden" name="answererid"  value="${lawyersDetails.studentid}">
									  </div>

									  <div class="form-group">
									    <div class="col-sm-offset-3 col-sm-8">
									      <button type="button" class="btn btn-default" id="publish">发布问题</button>
									    </div>
									  </div>
									</form>
									
								</div>
							</div>
						</div>


					</div>

					<div class="col-md-12 col-sm-12 col-xs-12" style="background:#fff;margin-top:20px;">						
							<div class="page-header">
						  	<h3>律师回答</h3>
							</div>
							<c:forEach items="${lawQuession}" var="lawQuession">
							<div class="req-box">
								<div class="req-info clearfix">
									<div class="req-icon pull-left">
										<span>问</span>
									</div>
									<div class="req-con pull-left">
										<p>${lawQuession.quesTitle}</p>
									</div>
								</div>
								<div class="req-info clearfix">
									<div class="req-icon pull-left">
										<span>答</span>
									</div>
									<div class="req-con pull-left">
										<p>${lawQuession.replycontent}</p>
									</div>
								</div>
								<div class="req-info text-right">
									<i class="icon icon-eye">123</i>
									<i class="icon icon-like text-red">2987</i>
									<i class="icon icon-clock">时间:<fmt:formatDate value="${lawQuession.replytime}" pattern="yyyy-MM-dd"/></i>
								</div>
							</div>
							</c:forEach>







					</div>
				</div>
				<div class="col-md-3 col-sm-3 hidden-xs">
					<div class="col-md-12 text-center hidden-xs clear-padding">
						<img src="img/260x200.png" alt="">
					</div>
					<div class="col-md-12 col-sm-12 col-xs-12 clear-padding center-block">
						<div class="sidebar-box">
							<form method="" action="">
								<h4>预约见面</h4>
								<hr/>
								<p>简单1步轻松搞定预定律师</p>
								<div class="text-center">
									<img src="img/230x150.png" alt="">
								</div>
								<hr class="dotted">
								<p>服务费用<b>200元</b><i>原价500元</i></p>
								<div class="form-group">						    
							  </div>
							  <button type="button" class="btn btn-warning btn-block">预约电话：2222222</button>
							</form>
						</div>
					</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	


	
</body>
</html>